﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package net.wooga.pets.views.popups.treatment {
    import reprise.ui.*;
    import flash.events.*;
    import flash.display.*;
    import reprise.controls.*;
    import net.wooga.pets.events.*;
    import net.wooga.pets.models.*;
    import net.wooga.pets.interfaces.*;
    import net.wooga.pets.views.popups.*;
    import net.wooga.pets.constants.*;
    import net.wooga.pets.utils.*;

    public class TreatmentPopupMediator extends AbstractPopupMediator {

        public var gameStateModel:GameStateModel;
        public var userModel:UserModel;

        override public function onRegister():void{
            super.onRegister();
            if (!this.hasShareButton){
                this.view.addCSSClass("tutorialMode");
            };
        }
        protected function setPatient(_arg1:UIComponent, _arg2:String, _arg3:Number):void{
            var _local4:MovieClip = AssetsLibrary.getMovieClip(_arg2);
            var _local5:UIComponent = RepriseUtils.addClipComponent(_arg1, "patient", _local4);
            Displays.correctScaling(_local5, _local4, _arg3, _arg3, 0, 1);
        }
        override protected function createOkButton(_arg1:String, _arg2:UIComponent=null):LabelButton{
            return (createButton(_arg2, "greenButton", _arg1, "myriadProFont"));
        }
        protected function sendPostOnWall(_arg1:String):void{
            var _local2:ITreatable;
            var _local3:String;
            var _local4:Object;
            var _local5:InfoEvent;
            if (this.hasShareButton){
                _local2 = ITreatable(this.view.data);
                _local3 = language.getTextByKey(("global_disease_no" + _local2.diseaseId));
                _local4 = {type:_arg1, disease_name:_local3, disease_id:_local2.diseaseType, pet:_local2};
                _local5 = new InfoEvent(EventConstants.POST_ON_WALL, null, _local4);
                dispatch(_local5);
            };
        }
        override protected function close():void{
            super.close();
            dispatch(new Event(EventConstants.BUBBLE_CLOSED));
        }
        protected function addPatientPicture(_arg1:String, _arg2:String, _arg3:Number, _arg4:Number, _arg5:UIComponent):void{
            var _local6:MovieClip = AssetsLibrary.getMovieClip(_arg1);
            var _local7:MovieClip = (_local6.content as MovieClip);
            var _local8:MovieClip = AssetsLibrary.getMovieClip(_arg2);
            _local7.addChild(_local8);
            Displays.correctScaling(_local7, _local8, 55, 55);
            RepriseUtils.addClipComponent(_arg5, "picture", _local6);
        }
        protected function get hasShareButton():Boolean{
            var _local1 = (this.gameStateModel.state == GameStateModel.STATE_GAME_RUNNING);
            _local1 = ((_local1) && ((this.userModel.level >= GameConstants.MIN_LEVEL_FOR_POST_LEVEL_UP)));
            return (_local1);
        }
        protected function get okButtonLabel():String{
            return ((this.hasShareButton) ? "global_button_share" : "global_button_goahead");
        }
        private function get view():AbstractPopupView{
            return ((viewComponent as AbstractPopupView));
        }

    }
}//package net.wooga.pets.views.popups.treatment 
